package com.springboot2.shiro.data.enity;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.springboot2.shiro.comm.entity.JpaEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/**
 * Resource
 *
 * @author Archx[archx@foxmail.com]
 * at 2018/7/13 21:06
 */
@Entity
@Getter
@Setter
@Table(name = "tb_resources")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Resource extends JpaEntity<Integer> {

    @Column(name = "name", length = 64)
    private String name;

    @Enumerated(EnumType.STRING)
    @Column(name = "type", length = 20)
    private Type type = Type.Menu;

    @Column(name = "url", length = 255)
    private String url;

    @Column(name = "permission", length = 255)
    private String permission;

    public enum Type {
        Menu, Button
    }
}
